const { merge } = require('webpack-merge');
const { defaultConfig, defaultConfigureWebpackConfig } = require('./commonConfig');
const { defaultChainWebpackConfig } = require('./chainCommonConfig')
function mergeConfig(config, ...args) {
    const mergedDefaultConfig = merge(defaultConfig, config);
    const [configureWebpackConfig, chainWebpackConfig] = [...args];
    const configureWebpack = Object.assign({}, defaultConfigureWebpackConfig, configureWebpackConfig)
    // const chainWebpack = Object.assign({}, defaultChainWebpackConfig, chainWebpackConfig);
    return {
        ...mergedDefaultConfig,
        configureWebpack,
        chainWebpack: (config) => {
            defaultChainWebpackConfig(config);
            if (chainWebpackConfig) {
                chainWebpackConfig(config)
            }
            const currentPlugins = config.plugins;
            // 输出插件信息
            
        }
    };
}

module.exports = {
    mergeConfig
}
